<?php

namespace app\common\model\Business;
// 引入框架模型
use think\Model;

class Receive extends Model
{
    protected $name = "business_receive";

    protected $autoWriteTimestamp = true;

    protected $createTime = 'applytime';

    protected $updateTime = false;
    protected $append = [
        'status_text', // 状态
    ];

    public function getStatusTextAttr($value, $data)
    {
        $status = ['apply' => '领取', 'allot' => '分配', 'recovery' => '回收', 'reject' => '拒绝'];

        return $status[$data['status']];
    }
    public function admin()
    {
        return $this->belongsTo('app\common\model\Admin','applyid','id',[],'LEFT')->setEagerlyType(0);
    }
    public function business()
    {
        return $this->belongsTo('app\common\model\Business\Business', 'busid', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
